//
//  PlaceOrderSpecTableViewCell.m
//  HAODE
//
//  Created by LiYinDi on 16/1/12.
//  Copyright © 2016年 reabam.com. All rights reserved.
//

#import "PlaceOrderSpecTableViewCell.h"
#import "MASConstraint.h"

@implementation PlaceOrderSpecTableViewCell

- (void)awakeFromNib {
    
    _countParentView.layer.borderWidth=1;
    _countParentView.layer.borderColor=[[UIColor colorWithRed:239.0f/255.0f green:239.0f/255.0f blue:239.0f/255.0f alpha:1.0f] CGColor];
    [self setAutoLayout];
}
 - (IBAction)subtractButtonClick:(UIButton *)sender {

     if ([self.delegate respondsToSelector:@selector(SpecCellSubtractCountBtnClick:parentIndex:)]) {
         
         [self.delegate SpecCellSubtractCountBtnClick:sender.tag parentIndex:self.parentIndex];
     }

}
- (IBAction)addBtnClick:(UIButton *)sender {
    if ([self.delegate respondsToSelector:@selector(SpecCellAddCountBtnClick:parentIndex:)]) {
        
        [self.delegate SpecCellAddCountBtnClick:sender.tag parentIndex:self.parentIndex];
    }
}

 -(void)setAutoLayout
{
   [_countParentView mas_makeConstraints:^(MASConstraintMaker *make) {
       make.right.equalTo(self.mas_right).with.offset(-10);
       make.width.equalTo(@140);
       make.height.equalTo(@34);
       make.centerY.equalTo(self.mas_centerY);
   }];
    [_addCountBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        //        make.left.equalTo(_productImageView.mas_right).with.offset(5);
        make.right.equalTo(_countParentView.mas_right);
        make.height.equalTo(@34);
        make.width.equalTo(@34);
        make.centerY.equalTo(_countParentView.mas_centerY);
    }];
    [_subtractCountBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        //        make.left.equalTo(_productImageView.mas_right).with.offset(5);
        make.left.equalTo(_countParentView.mas_left);
        make.height.equalTo(@34);
        make.width.equalTo(@34);
        make.centerY.equalTo(_countParentView.mas_centerY);
    }];

    [_countTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_subtractCountBtn.mas_right) ;
         make.right.equalTo(_addCountBtn.mas_left) ;
        make.height.equalTo(@12);
        
        make.centerY.equalTo(_countParentView.mas_centerY);
    }];

   

   [_lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(10);
        make.right.equalTo(self.mas_right).with.offset(-10);
        make.height.equalTo(@1);
       
        make.bottom.equalTo(self.mas_bottom);
    }];

}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
